package Before826.guesspanch;

import java.util.Scanner;

public class judger {
    Scanner input = new Scanner(System.in);
    Player human = new human();
    Player computer = new computer();
    boolean gamestart = false;
    boolean playAgain = true;
    public void gameStart(){
        System.out.println('\t' +"*********" );
        System.out.println('\t' + "**  " +"开始" + "**" + '\t');
        System.out.println('\t' +"*********" );
    }
    public boolean inname(){
        System.out.print("请选择对方角色(1:刘备2:孙权3:曹操):");
        int choice = input.nextInt();
        switch(choice){
            case 1:computer.setName("刘备");
                break;
                case 2:computer.setName("孙权");
                    break;
                    case 3:computer.setName("曹操");
                        break;
        }
        System.out.print("请输入你的姓名:");
        String name = input.next();
        human.setName(name);
        System.out.println(human.getName() + "   VS  " + computer.getName() +"  对战" );
        System.out.println();
        System.out.println("要开始吗:(y/n)");
        String answer = input.next();
        if(answer.equals("y")){
          gamestart = true;
        }
        return gamestart;

    }
    public void playgame(){
        int end1 = human.outpanch();
        int end2 = computer.outpanch();
        int score1 = human.Score;
        int score2 = computer.Score;
        int end;
      if(end1 ==1 && end2 ==0){
          System.out.println("平局");
      }
      if(end1 ==1 && end2 ==1){
          System.out.println("你输了");
          score2++;
      }
      if(end1 ==1 && end2 ==2){
          System.out.println("你赢了");
          score1++;
      }
      if(end1 ==2 && end2 ==0){
          System.out.println("你赢了");
          score1++;
      }
      if(end1 ==2 && end2 ==1){
          System.out.println("平局");
      }
      if(end1 ==2 && end2 ==2){
          System.out.println("你输了");
          score2++;
      }
      if(end1 ==3 && end2 ==0){
          System.out.println("你输了");
          score2++;
      }
      if(end1 ==3 && end2 ==1){
          System.out.println("你赢了");
          score1++;
      }
      if(end1 ==3 && end2 ==2){
          System.out.println("平局");
      }
      human.Score =  score1  ;
      computer.Score = score2 ;
        System.out.println();
        System.out.print("是否开启下一轮(y/n):");
        String answer = input.next();
        if(answer.equals("n")){
            playAgain = false;
        }
    }
    public void outstore(){
        System.out.println(computer.getName() + "  VS  " + human.getName());
        System.out.println("对战次数:" + computer.Score+human.Score);
        System.out.println();
        System.out.println("姓名" +'\t'+  "得分" );
        System.out.println(human.getName() + '\t' + human.Score);
        System.out.println(computer.getName() + '\t' + computer.Score);
        if(computer.Score == human.Score){
            System.out.println("平局,再接再厉");
        }
        if(human.Score > computer.Score){
            System.out.println("你赢了,真棒");
        }
        if(computer.Score < human.Score){
            System.out.println("你输了");
        }
        System.out.println("----------------------------------------");
    }
}
